package com.luoran.bartalks.service.impl;

import java.util.List;

import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.luoran.bartalks.dao.IBtPlanDetailsDao;
import com.luoran.bartalks.entity.BaseInfo;
import com.luoran.bartalks.entity.biz.BtPlanDetails;
import com.luoran.bartalks.service.IBtPlanDetailsService;

@Service
public class BtPlanDetailsService implements IBtPlanDetailsService {

	@Autowired
	private IBtPlanDetailsDao planDetailsDao;

	@Override
	public PageQuery<? extends BaseInfo> getQueryList(PageQuery<? extends BaseInfo> pageQuery) {
		planDetailsDao.queryPlanPage(pageQuery);
		return pageQuery;
	}

	//// 新增项目并返回主键
	@Override
	public String addPlan(BtPlanDetails plan) {
		planDetailsDao.insertTemplate(plan);
		return plan.getId();

	}

	@Override
	public BtPlanDetails getItemById(String id) {
		return planDetailsDao.single(id);
	}

	// 更新
	@Override
	public int updatePlan(BtPlanDetails plan) {
		return planDetailsDao.updateTemplateById(plan);
	}

	// 删除
	@Override
	public int deletePlan(BtPlanDetails plan) {
		return planDetailsDao.updateTemplateById(plan);
	}

	// 根据项目ID查询,是否有计划
	@Override
	public List<BtPlanDetails> findPlanByProjectId(String projectId) {

		return planDetailsDao.findPlanByProjectId(projectId);
	}

	@Override
	public int getStartedById(String id) {
		
		return planDetailsDao.getStartedById(id);
	}

	@Override
	public List<BtPlanDetails> getPlanByProjectIdOfAPP(List<String> projectId,String companyId) {
		return planDetailsDao.getPlanByProjectIdOfAPP(projectId,companyId);
	}



}
